package net.xinshi.exception;

import net.xinshi.utils.ErrorCode;

public class ApiException extends RuntimeException {
    static final long serialVersionUID = 1L;
    private String code;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public ApiException(String message) {
        super(message);
    }
    
    public ApiException(ErrorCode errorCode) {
        super(errorCode.getMsg());
        this.code = errorCode.getCode();
    }

    public ApiException(ErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }
    
    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApiException(String code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public ApiException(Throwable cause) {
        this(null, cause);
    }

    public ApiException(String code, String message) {
        this(code, message, null);
    }

}